from datetime import datetime
from sqlalchemy import Column,Integer,DateTime,String

from db_util import Base,engine,Session

class News(Base):
    __tablename__ = 't_news2'
    id = Column(Integer,primary_key=True,autoincrement=True)
    read_count = Column(Integer,default=1)
    update_time = Column(DateTime,default=datetime.now,onupdate=datetime.now)
    create_time = Column(DateTime,default=datetime.now)
    phone = Column(String(11),unique=True)
    title = Column(String(32),nullable=False)

def create_data():
    news1 = News(phone='16888888888',title='测试列参数')
    with Session() as session:
        session.add(news1)
        session.commit()

if __name__ == '__main__':
    # Base.metadata.create_all(engine)
    create_data()